<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    function post(url, paramObj, success, fail) {
        let param = new URLSearchParams();
        for (var index in paramObj) {
            var value = paramObj[index];
            param.append(index, value);
        }
        axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
        axios.post(url, param).then(response => {
            if (response.data.code != 1)
                return;
            success(response.data);
        }).catch(function (error) {
            console.info(error);
            if (undefined != fail)
                fail(error);
        });
    }
</script>